package team13;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;

public class TempMainController {

	public static void main(String[] args) {
		ArrayList<ArrayList<Integer>> clusterList = new ArrayList<ArrayList<Integer>>();
		for(int i = 0; i < 4; i++){
			clusterList.add(new ArrayList<Integer>());
		}

		try {
			BufferedReader in = new BufferedReader(new FileReader("time_movie_3_highBlockRemake"));
			String line;
			String[] nodes;
			in.readLine();
			line = in.readLine();
			nodes = line.split(" ");
			for(int i = 0; i < nodes.length; i++){
				clusterList.get(0).add(Integer.parseInt(nodes[i]));
			}
			in.readLine();
			line = in.readLine();
			nodes = line.split(" ");
			for(int i = 0; i < nodes.length; i++){
				clusterList.get(1).add(Integer.parseInt(nodes[i]));
			}
			
			for(Integer node: clusterList.get(0)){
				if(clusterList.get(1).contains(node)){
					System.out.println("wrong " + node);
				}
			}
			
			for(int i = 0; i < 28960; i++){
				if(!clusterList.get(0).contains(i) && !clusterList.get(1).contains(i)){
					clusterList.get(2).add(i);
				}
				if(clusterList.get(2).size() == 817){
					break;
				}
			}
			for(int i = 0; i < 28960; i++){
				if(!clusterList.get(0).contains(i) && !clusterList.get(1).contains(i) && !clusterList.get(2).contains(i)){
					clusterList.get(3).add(i);
				}
				if(clusterList.get(3).size() == 16542){
					break;
				}
			}
			
			try {
				BufferedWriter out = new BufferedWriter(new FileWriter("TEAM-13_A.txt"));
				
				for(int i = 0; i < clusterList.size(); i++){
					System.out.println("cluster: " + i + " size: " + clusterList.get(i).size());
					for(int j = 0; j < clusterList.get(i).size(); j++){
						out.write(clusterList.get(i).get(j) + " ");
					}
					out.newLine();
				}
				out.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
